export const useCommon = () => {
  // 获取最大最小值
  const getMaxAndMinValue = (params: any, data: any) => {
    const { end, start } = params || {};
    const length: number = data.length;
    const s = Math.round((length * start) / 100);
    const e = Math.round((length * end) / 100);
    const newArr = data.slice(s, e);
    const max = Math.max(...newArr.reduce((acc: any, val: any) => acc.concat(val), []));
    const min = Math.min(...newArr.reduce((acc: any, val: any) => acc.concat(val), []));
    return {
      max,
      min
    };
  };
  return {
    getMaxAndMinValue
  };
};
